// web/src/app/(employee)/_components/navbar-routes.tsx
'use client';
import React from 'react';
import {usePathname, useRouter} from "next/navigation";
import SearchInput from "@/components/learn/search-input";
import Link from "next/link";
import {Button} from "@/components/ui/button";
import {LogOut} from "lucide-react";
import UserButton from "@/features/auth/components/user-button";
import LogoutButton from "@/components/auth/logout-button";
import Toolbar from "@/app/(employee)/_components/toolbar";


const NavbarRoutes = () => {
    const pathname = usePathname()

    // todo: 公司端用的hr账号, 根据userid到数据库查找hr, 如果没用hr账号就不能进入公司端
    const isCompanyPage = pathname.startsWith('/company-side')
    const isStudentPage = pathname.includes('/student')

    return (
        // m auto 自动撑开
        <>
            <Toolbar/>
            <div className={`flex items-center gap-x-2 ml-auto`}>
                {isStudentPage || isCompanyPage ? (
                    <LogoutButton>
                        <Button
                            size={'sm'} variant={'ghost'}>
                            <LogOut className={`size-4 mr-2`}/>
                            Exit
                        </Button>
                    </LogoutButton>
                ) : (
                    <Link href={`/company-side`}>
                        <Button size={'sm'} variant={'ghost'}>
                            公司端
                        </Button>
                    </Link>
                )}
                <UserButton/>
            </div>
        </>
    );
};

export default NavbarRoutes;